package com.wenhui.schoolyardinfo.firstpage.ui.fragment;

import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.wenhui.schoolyardinfo.R;
import com.wenhui.schoolyardinfo.base.BaseFragment;
import com.wenhui.schoolyardinfo.callback.RcvOnFirstSecondThirdViewClickListener;
import com.wenhui.schoolyardinfo.callback.RcvOnFirstSecondViewClickListener;
import com.wenhui.schoolyardinfo.callback.RcvOnItemViewClickListener;
import com.wenhui.schoolyardinfo.customview.CommonPopupWindow;
import com.wenhui.schoolyardinfo.customview.RecyclerViewDivider;
import com.wenhui.schoolyardinfo.firstpage.adapter.BaseRecyclerAdapter;
import com.wenhui.schoolyardinfo.firstpage.adapter.BlogsAdapter;
import com.wenhui.schoolyardinfo.firstpage.bean.BlogBean;
import com.wenhui.schoolyardinfo.firstpage.bean.CommentBean;
import com.wenhui.schoolyardinfo.firstpage.bean.SubcommentsBean;
import com.wenhui.schoolyardinfo.firstpage.holder.SmartViewContentHolder;
import com.wenhui.schoolyardinfo.firstpage.ui.HomePageActivity;
import com.wenhui.schoolyardinfo.manager.InputManager;
import com.wenhui.schoolyardinfo.manager.LogManager;
import com.wenhui.schoolyardinfo.manager.PopupWindowManager;
import com.wenhui.schoolyardinfo.manager.ScreenManager;
import com.wenhui.schoolyardinfo.mine.ui.ShowPicturesActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * author    : Urasaki
 * e-mail    : 1164688204@qq.com
 * date      : 2019/6/15 09:18
 * introduce : 推荐Fragment
 */

public class RecommendFragment extends BaseFragment implements RcvOnFirstSecondThirdViewClickListener, RcvOnFirstSecondViewClickListener, RcvOnItemViewClickListener {

    private static final String TAG = "RecommendFragment";
    @BindView(R.id.mine_recycler_view)
    RecyclerView mineRecyclerView;
    @BindView(R.id.edt_input)
    EditText edtInput;
    @BindView(R.id.tev_send)
    TextView tevSend;
    @BindView(R.id.layout_input)
    RelativeLayout layoutInput;
    Unbinder unbinder;

    private BlogsAdapter blogsAdapter;
    private LinearLayoutManager layoutManager;
    private List<BlogBean> blogBeanList;
    private List<String> sceneryUrlList;
    private List<CommentBean> commentBeanList;
    private List<SubcommentsBean> subcommentsBeanList;
    //Popwindow
    private CommonPopupWindow window;
    private RecyclerView moreRecyclerView;
    private RelativeLayout layoutAngleLabelTop;
    private RelativeLayout layoutAngleLabelBottom;
    private BaseRecyclerAdapter<String> baseRecyclerAdapter;
    private List<String> stringList;
    private boolean isSubcomment;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_recommend, container, false);
        unbinder = ButterKnife.bind(this, view);

        initData();
        initViews();
        return view;
    }

    @Override
    protected void initData() {
        blogBeanList = new ArrayList<>();
        sceneryUrlList = new ArrayList<>();
        subcommentsBeanList = new ArrayList<>();
        commentBeanList = new ArrayList<>();
        sceneryUrlList.add("https://gss3.bdstatic.com/-Po3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike80%2C5%2C5%2C80%2C26/sign=5b4f6ad1a74bd11310c0bf603bc6cf6a/023b5bb5c9ea15cea5096eabbc003af33b87b2a9.jpg");
        sceneryUrlList.add("https://ws1.sinaimg.cn/large/0065oQSqly1fw0vdlg6xcj30j60mzdk7.jpg");
        sceneryUrlList.add("http://ww1.sinaimg.cn/large/0065oQSqly1fs1vq7vlsoj30k80q2ae5.jpg");
        subcommentsBeanList.add(new SubcommentsBean("卡尔.邓尼茨", "埃尔温.隆美尔", "我的狼群战术"));
        subcommentsBeanList.add(new SubcommentsBean("卡尔.邓尼茨", "埃尔温.隆美尔", "我的狼群战术"));

        commentBeanList.add(new CommentBean("埃尔温.隆美尔", "我的第七装甲师", subcommentsBeanList));
        commentBeanList.add(new CommentBean("埃尔温.隆美尔", "我的第七装甲师", subcommentsBeanList));

        blogBeanList.add(new BlogBean("https://ws1.sinaimg.cn/large/0065oQSqly1fw0vdlg6xcj30j60mzdk7.jpg", "埃尔温·隆美尔", 10000010101010L,
                "来自清华大学", "人活着的意义，就是活得有价值，可惜很多的人把这种价值看得太浅了，" +
                "认为拥有更多的财富、拥有社会地位、拥有名气就是价值的体现。这种价值是一种虚伪的价值，更经不起时间的考验。" +
                "因为这个世界不缺少物质，钱也只是我们获取物质的手段罢了。我们真正缺少的是一种精神、一种真理、一种新知与美，" +
                "因为这些才能贴近我们的情感，贴近人性，才能让我们感动，才能激发我们潜在的感情与能量。与物质有关的东西，最终是" +
                "会被时间所遗忘的，并会很快地被遗忘。即使被历史留下了，也是因为一种精神而被留下的。这个世界不缺乏物质，更因为" +
                "很多的人在内心深处，真正想要的并不是金钱利益，而是一种灵魂的归属，可是多数人从来就没有真正地了解过真实的自己，" +
                "只是把虚假的自己关在了一个笼子里痛苦，把真实的自己放在了笼子外流浪。我们应该更深层次地去发现自己，做个自己想要的那个自己。", sceneryUrlList,
                "军事家", 1000, 1000, 1000, 1000, commentBeanList));
        blogBeanList.add(new BlogBean("https://gss3.bdstatic.com/-Po3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike80%2C5%2C5%2C80%2C26/sign=5b4f6ad1a74bd11310c0bf603bc6cf6a/023b5bb5c9ea15cea5096eabbc003af33b87b2a9.jpg", "埃尔温·隆美尔", 10000010101010L,
                "来自清华大学", "人活着的意义，就是活得有价值，可惜很多的人把这种价值看得太浅了，" +
                "认为拥有更多的财富、拥有社会地位、拥有名气就是价值的体现。这种价值是一种虚伪的价值，更经不起时间的考验。" +
                "因为这个世界不缺少物质，钱也只是我们获取物质的手段罢了。我们真正缺少的是一种精神、一种真理、一种新知与美，" +
                "因为这些才能贴近我们的情感，贴近人性，才能让我们感动，才能激发我们潜在的感情与能量。与物质有关的东西，最终是" +
                "会被时间所遗忘的，并会很快地被遗忘。即使被历史留下了，也是因为一种精神而被留下的。这个世界不缺乏物质，更因为" +
                "很多的人在内心深处，真正想要的并不是金钱利益，而是一种灵魂的归属，可是多数人从来就没有真正地了解过真实的自己，" +
                "只是把虚假的自己关在了一个笼子里痛苦，把真实的自己放在了笼子外流浪。我们应该更深层次地去发现自己，做个自己想要的那个自己。", sceneryUrlList,
                "军事家", 1000, 1000, 1000, 1000, commentBeanList));
        blogBeanList.add(new BlogBean("https://ws1.sinaimg.cn/large/0065oQSqly1fw0vdlg6xcj30j60mzdk7.jpg", "埃尔温·隆美尔", 10000010101010L,
                "来自清华大学", "人活着的意义，就是活得有价值，可惜很多的人把这种价值看得太浅了，" +
                "认为拥有更多的财富、拥有社会地位、拥有名气就是价值的体现。这种价值是一种虚伪的价值，更经不起时间的考验。" +
                "因为这个世界不缺少物质，钱也只是我们获取物质的手段罢了。我们真正缺少的是一种精神、一种真理、一种新知与美，" +
                "因为这些才能贴近我们的情感，贴近人性，才能让我们感动，才能激发我们潜在的感情与能量。与物质有关的东西，最终是" +
                "会被时间所遗忘的，并会很快地被遗忘。即使被历史留下了，也是因为一种精神而被留下的。这个世界不缺乏物质，更因为" +
                "很多的人在内心深处，真正想要的并不是金钱利益，而是一种灵魂的归属，可是多数人从来就没有真正地了解过真实的自己，" +
                "只是把虚假的自己关在了一个笼子里痛苦，把真实的自己放在了笼子外流浪。我们应该更深层次地去发现自己，做个自己想要的那个自己。", sceneryUrlList,
                "军事家", 1000, 1000, 1000, 1000, commentBeanList));
        blogBeanList.add(new BlogBean("https://ws1.sinaimg.cn/large/0065oQSqly1fw0vdlg6xcj30j60mzdk7.jpg", "埃尔温·隆美尔", 10000010101010L,
                "来自清华大学", "人活着的意义，就是活得有价值，可惜很多的人把这种价值看得太浅了，" +
                "认为拥有更多的财富、拥有社会地位、拥有名气就是价值的体现。这种价值是一种虚伪的价值，更经不起时间的考验。" +
                "因为这个世界不缺少物质，钱也只是我们获取物质的手段罢了。我们真正缺少的是一种精神、一种真理、一种新知与美，" +
                "因为这些才能贴近我们的情感，贴近人性，才能让我们感动，才能激发我们潜在的感情与能量。与物质有关的东西，最终是" +
                "会被时间所遗忘的，并会很快地被遗忘。即使被历史留下了，也是因为一种精神而被留下的。这个世界不缺乏物质，更因为" +
                "很多的人在内心深处，真正想要的并不是金钱利益，而是一种灵魂的归属，可是多数人从来就没有真正地了解过真实的自己，" +
                "只是把虚假的自己关在了一个笼子里痛苦，把真实的自己放在了笼子外流浪。我们应该更深层次地去发现自己，做个自己想要的那个自己。", sceneryUrlList,
                "军事家", 1000, 1000, 1000, 1000, commentBeanList));
        blogBeanList.add(new BlogBean("https://ws1.sinaimg.cn/large/0065oQSqly1fw0vdlg6xcj30j60mzdk7.jpg", "埃尔温·隆美尔", 10000010101010L,
                "来自清华大学", "人活着的意义，就是活得有价值，可惜很多的人把这种价值看得太浅了，" +
                "认为拥有更多的财富、拥有社会地位、拥有名气就是价值的体现。这种价值是一种虚伪的价值，更经不起时间的考验。" +
                "因为这个世界不缺少物质，钱也只是我们获取物质的手段罢了。我们真正缺少的是一种精神、一种真理、一种新知与美，" +
                "因为这些才能贴近我们的情感，贴近人性，才能让我们感动，才能激发我们潜在的感情与能量。与物质有关的东西，最终是" +
                "会被时间所遗忘的，并会很快地被遗忘。即使被历史留下了，也是因为一种精神而被留下的。这个世界不缺乏物质，更因为" +
                "很多的人在内心深处，真正想要的并不是金钱利益，而是一种灵魂的归属，可是多数人从来就没有真正地了解过真实的自己，" +
                "只是把虚假的自己关在了一个笼子里痛苦，把真实的自己放在了笼子外流浪。我们应该更深层次地去发现自己，做个自己想要的那个自己。", sceneryUrlList,
                "军事家", 1000, 1000, 1000, 1000, commentBeanList));

        stringList = new ArrayList<>();
        stringList.add("关注");
        stringList.add("私信");
        stringList.add("收藏");
        stringList.add("举报");
    }

    @Override
    protected void initViews() {

        initAdapter();
        initPopupWindow();
    }

    private void initAdapter() {
        layoutManager = new LinearLayoutManager(getActivity());
        layoutManager.setOrientation(OrientationHelper.VERTICAL);
        mineRecyclerView.setLayoutManager(layoutManager);
        mineRecyclerView.setItemAnimator(new DefaultItemAnimator());
        mineRecyclerView.addItemDecoration(new RecyclerViewDivider(
                getActivity(),
                LinearLayoutManager.VERTICAL,
                ScreenManager.dipTopx(getActivity(), 1),
                getResources().getColor(R.color.colorGrayB)));

        blogsAdapter = new BlogsAdapter(getActivity());
        mineRecyclerView.setAdapter(blogsAdapter);
        blogsAdapter.setRcvOnItemViewClickListener(this);
        blogsAdapter.setRcvOnFirstSecondViewClickListener(this);
        blogsAdapter.setRcvOnFirstSecondThirdViewClickListener(this);
        blogsAdapter.clearData();
        blogsAdapter.addAllData(blogBeanList);
    }

    private void initPopupWindow() {
        // create popup window
        window = new CommonPopupWindow(getActivity(), R.layout.popup_window_recommend, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
            @Override
            protected void initViews() {
                View view = getContentView();
                layoutManager = new LinearLayoutManager(getActivity());
                layoutManager.setOrientation(OrientationHelper.VERTICAL);

                moreRecyclerView = view.findViewById(R.id.more_recycler_view);
                layoutAngleLabelTop = view.findViewById(R.id.layout_angle_label_top);
                layoutAngleLabelBottom = view.findViewById(R.id.layout_angle_label_bottom);
                moreRecyclerView.setItemAnimator(new DefaultItemAnimator());
                moreRecyclerView.setLayoutManager(layoutManager);
                moreRecyclerView.addItemDecoration(new RecyclerViewDivider(
                        getActivity(),
                        LinearLayoutManager.VERTICAL,
                        ScreenManager.dipTopx(getActivity(), 1),
                        getResources().getColor(R.color.colorGrayB)));
                baseRecyclerAdapter = new BaseRecyclerAdapter<String>(R.layout.item_popup_window_recommend, 1) {
                    @Override
                    protected void onBindViewHolder(RecyclerView.ViewHolder holder, String model, int position) {
                        if (holder instanceof SmartViewContentHolder) {
                            SmartViewContentHolder smartViewContentHolder = (SmartViewContentHolder) holder;
                            smartViewContentHolder.text(R.id.tev_concern, model);

                            View viewConcern = smartViewContentHolder.getView(R.id.view_concern);
                            if (position == stringList.size() - 1) {
                                viewConcern.setVisibility(View.GONE);
                            }
                        }
                    }
                };

                moreRecyclerView.setAdapter(baseRecyclerAdapter);

                baseRecyclerAdapter.clearData();
                baseRecyclerAdapter.addAllData(stringList);
            }

            @Override
            protected void initEvent() {
                baseRecyclerAdapter.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        switch (position) {
                            case 0:
                                showToast("点击了concern");
                                break;
                            case 1:
                                showToast("点击了privateLetter");
                                break;
                            case 2:
                                showToast("点击了collect");
                                break;
                            case 3:
                                showToast("点击了report");
                                break;
                        }
                        window.getPopupWindow().dismiss();
                    }
                });
            }

            @Override
            protected void initWindow() {
                super.initWindow();
                PopupWindow instance = getPopupWindow();
                instance.setOnDismissListener(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes();
                        lp.alpha = 1.0f;
                        getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
                        getActivity().getWindow().setAttributes(lp);
                    }
                });
            }
        };
    }

    private void showPopupWindow(View anchorView) {
//        View contentView = CommonPopupWindow();
//        mPopupWindow = new PopupWindow(contentView,
//                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
        // 如果不设置PopupWindow的背景，有些版本就会出现一个问题：无论是点击外部区域还是Back键都无法dismiss弹框
//        mPopupWindow.setBackgroundDrawable(new ColorDrawable());
//        // 设置好参数之后再show
//        int windowPos[] = PopupWindowManager.calculatePopWindowPos(anchorView, contentView);
//        int xOff = 20; // 可以自己调整偏移
//        windowPos[0] -= xOff;
//        mPopupWindow.showAtLocation(anchorView, Gravity.TOP | Gravity.START, windowPos[0], windowPos[1]);

        PopupWindow mPopupWindow = window.getPopupWindow();
        mPopupWindow.setAnimationStyle(R.style.animTranslate);
        mPopupWindow.setBackgroundDrawable(new ColorDrawable());
        // 设置点击窗口外边窗口消失
        mPopupWindow.setOutsideTouchable(true);
        // 设置此参数获得焦点，否则无法点击
        mPopupWindow.setFocusable(true);
        // 设置好参数之后再show
        int windowPos[] = PopupWindowManager.calculatePopWindowPos(anchorView, window.getContentView());
        int xOff = 20; // 可以自己调整偏移
        windowPos[0] -= xOff;

        //是否需要向上弹出/向下弹出显示
        boolean isNeedShowUp = PopupWindowManager.isNeedShowUp(anchorView, window.getContentView());
        if (isNeedShowUp) {
            layoutAngleLabelTop.setVisibility(View.GONE);
            layoutAngleLabelBottom.setVisibility(View.VISIBLE);
        } else {
            layoutAngleLabelTop.setVisibility(View.VISIBLE);
            layoutAngleLabelBottom.setVisibility(View.GONE);
        }
        // 设置popupWindow的显示位置
        mPopupWindow.showAtLocation(anchorView, Gravity.TOP | Gravity.START, windowPos[0], windowPos[1]);

//        // 设置popupWindow的显示位置，此处是在手机屏幕底部且水平居中的位置
//        mPopupWindow.showAtLocation(anchorView, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);

        WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes();
        lp.alpha = 0.3f;
        getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        getActivity().getWindow().setAttributes(lp);
    }

    private void startActivity(int currentPosition, List<String> sceneryUrlList) {
        Intent intent = new Intent(getActivity(), ShowPicturesActivity.class);
        Bundle bundle = new Bundle();
        ArrayList<String> photoUrlList = new ArrayList<>();
        photoUrlList.addAll(sceneryUrlList);
        bundle.putInt("currentPosition", currentPosition);
        bundle.putStringArrayList("photoUrlList", photoUrlList);
        intent.putExtras(bundle);
        startActivity(intent);
        getActivity().overridePendingTransition(R.anim.translate_out, R.anim.translate_in);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();

    }

    @Override
    public void onItemClickListener(int position, View view) {
        switch (view.getId()) {
            case R.id.imv_head_portrait:
                showToast(position + "*****点击了imv_head_portrait");
                startActivity(HomePageActivity.class);
//                startActivity(JurisdictionReleaseActivity.class);
                break;
            case R.id.layout_more:
                showPopupWindow(view);
                break;
            case R.id.layout_fire:
                showToast(position + "*****点击了layout_fire");
                break;
            case R.id.layout_feeling:
                showToast(position + "*****点击了layout_feeling");
                break;
            case R.id.layout_comment:
                showToast(position + "*****点击了layout_comment");
                break;
            case R.id.layout_shared:
                showToast(position + "*****点击了layout_shared");
                break;
            case R.id.layout_spread:
                showToast(position + "*****点击了layout_spread");
                commentBeanList.add(new CommentBean("埃尔温.隆美尔", "我的第七装甲师", subcommentsBeanList));
                commentBeanList.add(new CommentBean("埃尔温.隆美尔", "我的第七装甲师", subcommentsBeanList));
                commentBeanList.add(new CommentBean("埃尔温.隆美尔", "我的第七装甲师", subcommentsBeanList));
                commentBeanList.add(new CommentBean("埃尔温.隆美尔", "我的第七装甲师", subcommentsBeanList));
                commentBeanList.add(new CommentBean("埃尔温.隆美尔", "我的第七装甲师", subcommentsBeanList));

                blogsAdapter.clearData();
                blogsAdapter.addAllData(blogBeanList);
                break;
            case R.id.imv_scenery_i_a:
                startActivity(0, blogBeanList.get(position).getSceneryUrlList());
                break;
            case R.id.imv_scenery_ii_a:
                startActivity(0, blogBeanList.get(position).getSceneryUrlList());
                break;
            case R.id.imv_scenery_ii_b:
                startActivity(1, blogBeanList.get(position).getSceneryUrlList());
                break;
            case R.id.imv_scenery_iii_a:
                startActivity(0, blogBeanList.get(position).getSceneryUrlList());
                break;
            case R.id.imv_scenery_iii_b:
                startActivity(1, blogBeanList.get(position).getSceneryUrlList());
                break;
            case R.id.imv_scenery_iii_c:
                startActivity(2, blogBeanList.get(position).getSceneryUrlList());
                break;
            default:
                break;
        }
    }

    @Override
    public void onItemItemClickListener(int position, int position2, View view) {
        switch (view.getId()) {
            case R.id.tev_name:
                showToast("position:" + position
                        + "***position2:" + position2 + "*****点击了tev_name");
                LogManager.i(TAG, "position:" + position
                        + "***position2:" + position2 + "*****点击了tev_name");
                break;
            case R.id.tev_comment:
                showToast("position:" + position
                        + "***position2:" + position2 + "*****点击了tev_comment");
                LogManager.i(TAG, "position:" + position
                        + "***position2:" + position2 + "*****点击了tev_comment");
                layoutInput.setVisibility(View.VISIBLE);
                isSubcomment = false;
                InputManager.showInput(edtInput);
                break;
            case R.id.layout_spread:
                showToast("position:" + position
                        + "***position2:" + position2 + "*****点击了layout_spread");
                LogManager.i(TAG, "position:" + position
                        + "***position2:" + position2 + "*****点击了layout_spread");
                subcommentsBeanList.add(new SubcommentsBean("卡尔.邓尼茨", "埃尔温.隆美尔", "我的狼群战术"));
                subcommentsBeanList.add(new SubcommentsBean("卡尔.邓尼茨", "埃尔温.隆美尔", "我的狼群战术"));
                subcommentsBeanList.add(new SubcommentsBean("卡尔.邓尼茨", "埃尔温.隆美尔", "我的狼群战术"));
                subcommentsBeanList.add(new SubcommentsBean("卡尔.邓尼茨", "埃尔温.隆美尔", "我的狼群战术"));
                subcommentsBeanList.add(new SubcommentsBean("卡尔.邓尼茨", "埃尔温.隆美尔", "我的狼群战术"));

                blogsAdapter.clearData();
                blogsAdapter.addAllData(blogBeanList);
                break;
            default:
                break;
        }
    }

    @Override
    public void onItemItemItemClickListener(int position, int position2, int position3, View view) {
        switch (view.getId()) {
            case R.id.tev_first_name:
                showToast("position:" + position
                        + "***position2:" + position2
                        + "***position3:" + position3 + "*****点击了tev_first_name");
                LogManager.i(TAG, "position:" + position
                        + "***position2:" + position2
                        + "***position3:" + position3 + "*****点击了tev_first_name");
                break;
            case R.id.tev_second_name:
                showToast("position:" + position
                        + "***position2:" + position2
                        + "***position3:" + position3 + "*****点击了tev_second_name");
                LogManager.i(TAG, "position:" + position
                        + "***position2:" + position2
                        + "***position3:" + position3 + "*****点击了tev_second_name");
                break;
            case R.id.tev_subcomment:
                showToast("position:" + position
                        + "***position2:" + position2
                        + "***position3:" + position3 + "*****点击了tev_subcomment");
                LogManager.i(TAG, "position:" + position
                        + "***position2:" + position2
                        + "***position3:" + position3 + "*****点击了tev_subcomment");
                layoutInput.setVisibility(View.VISIBLE);
                isSubcomment = true;
                InputManager.showInput(edtInput);
                break;
            default:
                break;
        }
    }

    @OnClick(R.id.tev_send)
    public void onViewClicked() {
        LogManager.i(TAG, "tev_send");
        String sendStr = edtInput.getText().toString();
        if (sendStr != null && !"".equals(sendStr)) {
            if (isSubcomment) {
                subcommentsBeanList.add(new SubcommentsBean("卡尔.邓尼茨", "埃尔温.隆美尔", sendStr));
                blogsAdapter.clearData();
                blogsAdapter.addAllData(blogBeanList);
            } else {
                commentBeanList.add(new CommentBean("卡尔.邓尼茨", sendStr, subcommentsBeanList));
                blogsAdapter.clearData();
                blogsAdapter.addAllData(blogBeanList);
            }
            layoutInput.setVisibility(View.GONE);
        }

    }
}
